using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Text;
using System.Xml;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using OR.Reuse.Persistence;

using OR.Lazarus.Library.CPP.Notation;

namespace OR.Lazarus.Library.Tests.CPP
{
	/// <summary>
	/// Summary description for TypesTests
	/// </summary>
	[TestClass]
    [Ignore]
	public class NotationTests : CPPTestBase< NotationMapDetail >
	{
		public NotationTests()
		{
			//
			// TODO: Add constructor logic here
			//
		}

		#region Additional test attributes
		//
		// You can use the following additional attributes as you write your tests:
		//
		// Use ClassInitialize to run code before running the first test in the class
		// [ClassInitialize()]
		// public static void MyClassInitialize(TestContext testContext) { }
		//
		// Use ClassCleanup to run code after all tests in a class have run
		// [ClassCleanup()]
		// public static void MyClassCleanup() { }
		//
		// Use TestInitialize to run code before running each test 
		// [TestInitialize()]
		// public void MyTestInitialize() { }
		//
		// Use TestCleanup to run code after each test has run
		// [TestCleanup()]
		// public void MyTestCleanup() { }
		//
		#endregion

		[TestInitialize()]
		public void CPP_Types_TestInitialize()
		{
			this.InitializePersistence();
			this.InitializeDetail( "Notation.xml" );
		}

		[TestMethod]
		public void CPP_Notation_Load()
		{
//			TypeDetail vTypeDetail;

			// Validate contents
			Assert.IsTrue( mDetail.DefaultNames.Count == 1, String.Format( ErrorInvalidCount, "Default Names", 1, mDetail.Types.Count ) );
			Assert.IsTrue( mDetail.Types.Count == 3, String.Format( ErrorInvalidCount, "Types", 3, mDetail.Types.Count ) );
		}

		[TestMethod]
		public void CPP_Notation_Resolve_Type()
		{
			string vResolvedNotation = null;

			vResolvedNotation = mDetail.ResolveContextNotation( "vt:string", "CPP" );

			Assert.IsTrue( vResolvedNotation == "sz", "Invalid Notation Resolution for 'CPP' context of 'vt:string'.  Expected 'sz', found '" + vResolvedNotation + "'." );
		}

		[TestMethod]
		public void CPP_Notation_Resolve_DefaultType()
		{
			string vResolvedNotation = null;

			vResolvedNotation = mDetail.ResolveContextNotation( "vt:unspecified", "CPP" );

			Assert.IsTrue( vResolvedNotation == "p", "Invalid Notation Resolution for 'CPP' context of 'vt:unspecified'.  Expected 'p', found '" + vResolvedNotation + "'." );
		}

		[TestMethod]
		public void CPP_Notation_Resolve_BadContext_DefaultType()
		{
			string vResolvedNotation = null;

			vResolvedNotation = mDetail.ResolveContextNotation( "vt:unspecified", "unsupported" );

			Assert.IsTrue( String.IsNullOrEmpty( vResolvedNotation ), "Invalid Notation Resolution for 'unsupported' context of 'vt:unspecified'.  Expected '', found '" + vResolvedNotation + "'." );
		}
	}
}
